package root.electronclass.electronclass.mvp.base;


import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;


public class DialogViewModel extends ViewModel {
    public MutableLiveData<Boolean> showProgressData = new MutableLiveData<>();
    public MutableLiveData<BaseResponse> showErrorData = new MutableLiveData<>();
    public MutableLiveData<Throwable> showExceptionData = new MutableLiveData<>();
    public MutableLiveData<Integer> multiRequest = new MutableLiveData<>();

    public Integer getMultiRequest() {
        return multiRequest.getValue();
    }

    public void setMultiRequest(int multiRequest) {

        this.multiRequest.setValue(multiRequest);
    }

    public void addRequest() {

        this.multiRequest.setValue(multiRequest.getValue() + 1);
    }

    public void delRequest() {
        if (multiRequest.getValue() - 1 <= 0) {
            this.multiRequest.setValue(null);
        } else {
            this.multiRequest.setValue(multiRequest.getValue() - 1);
        }

    }
}
